<?php

include 'conn.php';

function crowFather( $query , $returnType){

	#Easy SQL queries. Gimme a query , I'll execute it for you. The second var is the return type
	#
	#1=fetchAll
	#2=rowCount
	#3=No data returned - returns 0 on completion
	#4=fetchAll
	#5=rowCount for all drivers. Must be a count.
	#
	#With this we will know all
	#
	
	global $PDO_db;
	
	$queryMechanism = $PDO_db->prepare($query);
	
	
	$queryMechanism->execute();
	
	switch ($returnType){
	
		case 1:
			return $queryMechanism->fetchAll();
			break;
		case 2:
			return $queryMechanism->rowCount();
			break;
		case 3:
			#return 0;
			break;
		case 4:
			return $queryMechanism->fetchAll(PDO::FETCH_NUM);
			break;
		case 5:
			return $queryMechanism->fetchColumn();
			break;
		default:
			return "#Error: returnType incorrect";
			break;
	}
	
	$queryMechanism->closeCursor();

}
?>
